package com.kwin.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;

public class FileServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        ServletContext servletContext = this.getServletContext();
//        InputStream in = servletContext.getResourceAsStream("202d312a8ab6750d1c2cb816acee7fbb.jpeg");

        ClassLoader classLoader = FileServlet.class.getClassLoader();
        InputStream in = classLoader.getResourceAsStream("202d312a8ab6750d1c2cb816acee7fbb.jpeg");
        System.out.println(in);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
